/*
 * Copyright (c) 2005-2006 FeySoft Inc. All Rights Reserved.
 */
package com.feyaSoft.home.hibernate.demouser;

import java.io.Serializable;
import java.util.Date;

import org.json.JSONObject;

import com.feyaSoft.plugin.util.DateUtil;

public class Demouser implements Serializable {
	private static final long serialVersionUID = -6607672285365469294L;

	private Long id;
	private String username = null;
	private String password = null;
	private String firstName = "";
	private String lastName = "";
	private String email = "";
	private String note = "";
	private Date birthday = null;
	private Date creationDate = new Date();
	private Date updateDate = new Date();

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	/**
	 * This is for JSON - ajax part...
	 * 
	 * @return
	 * @throws Exception
	 */
	public JSONObject toJSONObject() throws Exception {		
		String birthdayString = DateUtil.format(birthday, "MMM dd, yyyy");

		JSONObject json = new JSONObject();
		json.put("birthday", birthdayString);
		json.put("username", this.username);
		json.put("firstname", this.firstName);
		json.put("lastname", this.lastName);
		json.put("password", this.password);
		json.put("email", this.email);
		json.put("note", note);
		json.put("id", this.id);

		return json;
	}
}